<template>
	<view class="courselist">
		<search></search>
		<view class="item" v-for="item in courses">
			<course-list :course="item"></course-list>
		</view>
	</view>
</template>

<script setup>
	import {
		ref
	} from 'vue';
	import {
		isTeacher
	} from '../../apis/teacher.js'
	import {apiGetAllCourseById} from '../../apis/teacherDetail.js'
	import {
		onMounted
	} from 'vue'
	const teacherId = ref('')
	const member = uni.getStorageSync('member');
	const courses = ref([])
	const getCourseList= async (id) => {
		const res = await apiGetAllCourseById(id)
		console.log(id)
		courses.value = res.data.data
		console.log(courses.value)
	}
	const getCourses=async(phone)=>{
		const res= await isTeacher(phone)
		if(res.data.code==200){
			teacherId.value=res.data.data.id
			console.log(teacherId.value)
			getCourseList(teacherId.value)
			console.log(courses.value)
		}
	}
	getCourses(member.mobile)
</script>

<style lang="scss" scoped>

</style>
